#ifndef __SNAKE_H
#define __SNAKE_H

#include "point.h"

#ifndef bool
	#define bool unsigned short
	#define true 1
	#define false 0
#endif

enum Direction { NORTH, EAST, SOUTH, WEST };


typedef struct __snake_piece
{
	Point point;
	struct __snake_piece *ptrNext;
} SnakePiece;

typedef struct __snake
{
	SnakePiece *ptrHead;
	int iPiecesToDraw;
	enum Direction eCurrentDirection, ePreviousDirectionMoved;
	char cSnakeChar;
} Snake;

typedef struct __snake_collection
{
	Snake *ptrSnake;
	struct __snake_collection *ptrNext;
	struct sockaddr_in *ptrRemoteSocketAddress;
	int iRemotePort;
} SnakeCollection;


extern Point objFoodPoint;
extern SnakeCollection *objSnakeCollection;
extern char cNextSnakeChar;
extern int iSelfServerPort;
extern int iUDPSendingFD;

char getNextSnakeChar();
Snake* initSnake(Point point, char cSnakeChar);
int getSnakeLength(Snake *ptrSnake);
void removeOneSnakePiece(Snake *ptrSnake);
void addOneSnakePiece(Snake *ptrSnake, Point objPoint);
bool advanceSnake(Snake *ptrSnake);
void placeNewFood();

#endif
